{extends file="template.tpl"}
{* STYLE SHEETS *}
{block name=css}<link rel="stylesheet" href="css/general.css" type="text/css" />
{if isset($sectionCss)}
        <link rel="stylesheet" href="css/section.css" type="text/css" />
        <link rel="stylesheet" href="css/{$sectionCss}.css" type="text/css" />
        <link rel="stylesheet" href="dtree/dtree.css" type="text/css" />
        <script type="text/javascript" src="dtree/basic_dtree.js"></script>
{/if}
{/block}

{* LEFT MENU *}
{block name=leftMenu}
                <div id="leftMenu" style="font-size: 8px;" >
                <script type="text/javascript">
                    articleTree = new dTree('articleTree');
                    articleTree.config.useLines = false;
                    articleTree.config.useIcons = false;
                    articleTree.add(0,-1, '{$sectionName}', 'section.php?section=' + '{$sectionId}');
                    //Add articles
                    {foreach $articles as $article}
                        articleTree.add( 100000 + {$article->id}, {$article->parentid}, '{$article->subject}', 'section.php?section=' + '{$sectionId}' + '&article=' + '{$article->id}' );
                    {/foreach}
                    //Add categories
                    {foreach $categories as $category}
                        articleTree.add( {$category->id}, {$category->parentid}, '{$category->name}');
                    {/foreach}
                    document.write(articleTree);
                    {if isset($currentArticle)}
                        articleTree.closeAll();
                        articleTree.openTo(100000 + {$currentArticle->id}, true);
                    {else}
                        articleTree.s(0);
                    {/if}
                </script>
                </div>
{/block}

{* CONTENT *}
{block name=content}
{if isset($sectionName)}
    {if isset($currentArticle)}
        {if isset($currentUser) && $currentUser->isEditor()}
                <form method="POST" action="take_position_update.php"><input type="hidden" name="articleId" value="{$currentArticle->id}" /><input type="hidden" name="sectionId" value="{$sectionId}" /><input type="hidden" name="action" value="moveUp" /><input type="submit" class="upButton" value=""/></form>
                <a class="editLink" href="admin.php?option=edit_article&article={$currentArticle->id}">Aanpassen</a>
                <form method="POST" action="take_position_update.php"><input type="hidden" name="articleId" value="{$currentArticle->id}" /><input type="hidden" name="sectionId" value="{$sectionId}" /><input type="hidden" name="action" value="moveDown" /><input type="submit" class="downButton" value="" /></form>
        {/if}
                <h1>{$currentArticle->subject}</h1>
                {$currentArticle->text}
    {else}
        {if isset($currentUser) && $currentUser->isEditor()}
                <a class="editLink" href="admin.php?option=edit_section&section={$sectionId}">Aanpassen</a>
        {/if}
                <h1>{$sectionName}</h1>
                {$sectionDescription}
    {/if}
{else}
                <h1 style='color:darkred'>Ongeldige sectie gekozen</h1>
{/if}
{/block}